Skip to main content

RESTful Engine Java Client Reference

This article describes how to get the Fluent RESTful V2 Java Client installed, as well as a list of all methods and models defined in the client.

Setting Up the Client

note

To see a sample application using the Fluent RESTful V2 JavaClient, please refer to our sample Java application github page.

You can add the client as a Maven package to your POM file:

  • Maven package name: WindwardRESTJava8Client
  • Maven package latest version: 22.1.0.0
<repositories>    
<repository>
<id>windward-libs</id>
<name>windward-libs</name>
<url>https://windward.mycloudrepo.io/public/repositories/windward-libs</url>
</repository>
</repositories>
.
.
.
<dependencies>
<dependency>
<groupId>net.windward</groupId>
<artifactId>WindwardRESTJava8Client</artifactId>
<version>22.1.0.0</version>
</dependency>
.
.
.

You then want to import the Client class, and instantiate an instance of the client:

import WindwardRestApi.Api.WindwardClient;
import WindwardRestApi.Model.*;
public class RunReport {

private static WindwardClient client;
.
.
.

client = new WindwardClient("RESTful_server_address");

Client Models

info

This section will go over the relevant models associated with the client that you will use. To import the models into your project, use: import WindwardRestApi.src.Model;

Template

These are the parameters for the Template object constructor:

:param callback : If set, this url will be called with a POST when a job completes. If the text "{guid}" is in the url, that text will
be replaced with the Guid for the callback.
:type str

:param outputFormat : The desired output file type (set using the Template.OutputFormatEnum())
:type str

:param data : The file path for your template (the client will encode to base64) (only use if connectionString is None)
:type str : string representation of the file path

:param connectionString : The connection string to your template file (only use if data is None)
:type str

:param format : The format of the template to be processed (if left empty it will auto populate)
:type str

:param properties : Fluent properties for this report. These override any properties set in the configuration file on the server side.
:type List[Property] : A list of Property objects

:param parameters : A set of input parameters for this report. The parameters are global and shared among all data sources.
:type List[Parameter] : A list of Property objects

:param datasources : The datasources to apply to the template. The datasources are applied simultaneously.
:type List[Datasource] : A list of Datasource objects

:param tag : A tag you want to assign to the template.
This is passed in to the repository job handlers and is set in the final generated Report object
:type str

:param trackImports : Return all imports with the generated document
:type bool

:param trackErrors : Enable or disable the error handling and verify functionality.
:type bool

:param mainPrinter : If you are using printer output use to specify main printer. Printer must be recognized by Network
:type str

:param firstPagePrinter : Set first page printer if main printer is already set
:type str

:param printerJobName : Assign the print job a name
:type str

:param printCopies : Set number of copies the print job should print
:type str

:param printDuplex : Selects the printers duplex mode
:type str

Here are the different constructors for the Template object:

Template(OutputFormatEnum outputFormat, string connectionString, FormatEnum format)

Template(OutputFormatEnum outputFormat, byte[] data, FormatEnum format)

Template(string connectionString, FormatEnum format)

Template(byte[] data, FormatEnum format)

Template()

Only set the input parameters that apply to your report. You must have either the data input parameter or the connectionString input parameter set.

XML 1.0 Data Source

These are the input parameters for the XML 1.0 data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the XML1 data (only use if data is None)
:type str

:param data : The file path to the XML1 data file (only use if connectionString is None)
:type str : the file path to the XML1 data file as a string

:param schemaConnectionString : The connection string to the XSD file. None if no schema
:type str

Here are the different constructors for the Xml_10DataSource object:

Xml_10DataSource(string name, string connectionString, string schemaConnectionString)

Xml_10DataSource(string name, byte[] data, byte[] schemaData)

SQL Data Source

These are the input parameters for the SQL data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param className : The ADO.NET connector classname
:type str

:param connectionString : The connection string to the SQL data
:type str

Here is the constructor for the SqlDataSource object:

SqlDataSource(string name, string className, string connectionString)

Salesforce OAuth Data Source

These are the input parameters for the SalesforceOauth data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the SalesforceOAuth data
:type str

Here is the constructor for the SalesforceOAuthDataSourceobject:

SalesforceOAuthDataSource(string name, string connectionString)

Salesforce Data Source

These are the input parameters for the Salesforce data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the Salesforce data
:type str

Here is the constructor for the SalesforceDataSource object:

SalesforceDataSource(string name, string connectionString)

OData Data Source

These are the input parameters for the OData data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the OData data
:type str

Here is the constructor for the ODataDataSource object:

ODataDataSource(string name, string connectionString)

JSON Data Source

These are the input parameters for the JSON data source constructor:

:param name : The datasource name that maps to the datasource attribute in tags
:type str

:param connectionString : The connection string to the JSON data file (only use if data is None)
:type str

:param data : The file path to the JSON data file (only use if connectionString is None)
:type str : the file path to the JSON data file as a string

Here arethe constructors for the JsonDataSource object:

JsonDataSource(string name, string connectionString)

JsonDataSource(string name, byte[] data)

Parameter

These are the input parameters for the Parameter constructor:

:param name : The name of the property
:type str

:param value: The value of the property. You can pass any primitive, null, a DateTime, or DateTimeOffset. You cannot pass lists or arrays
:type object

(Parameter value explained next) The template object takes in a list of Parameter objects, so if you have multiple, append them to an array and pass them in that way.

template.Parameters.Add(new Parameter(pair.Key, pair.Value));

Client Methods

Client Constructor

Input Parameters:

:param Uri: The uri to your RESTful engine instance
:type str

:param licenseKey: Optional parameter if you wanted to process a report with a specific license key.
:type str

This is how you would call it:

client = new WindwardClient(new Uri(restful_engine_url));

Client.GetVersion()

This method is used to get the version information with regards to the server and the local client. No input parameters. How to call:

VersionInfo version = client.GetVersion();

Returns version data

Client.PostDocument(Template t)

This method is used to post the constructed template object to the RESTful engine. Takes in a Template object How to call:

Document document = client.PostDocument(template);

Returns a document object.

Client.GetDocumentStatus(string GUID)

This method is used to get the status of the document being processed. You MUST use this method to check the status of the document before getting the document back. How to call:

HttpStatusCode status = client.GetDocumentStatus(guid);

This is how we recommend using this in your application:

 while (true)            
{
Thread.Sleep(100);
HttpStatusCode status = client.GetDocumentStatus(guid);
if (status == HttpStatusCode.Found)
break;
if (status == HttpStatusCode.Accepted || status == HttpStatusCode.Created)
continue;
}

We need to wait until GetDocumentStatus() returns 302. The method returns Http status codes.

Client.GetDocument(string GUID)

This method is used to get the document after its done processing. You pass to it the Guid:

Document document = client.GetDocument(guid);

This method returns the document object.

Client.DeleteDocument(string guid)

This method is used to delete the document after its done processing. You pass to it the Guid:

Document document = client.DeleteDocument(guid);